#include<stdio.h>
#include<string.h>
int main(int argc, char const *argv[])
{
    char buf[128];
    char filename[20];
    char choice;
    printf("please input filename:");
    scanf("%s",filename);
    FILE *fp = fopen(filename,"w");
    if(fp == NULL)
    {
        perror("fopen() fail");
        return -1;
    }
    int flag=1;
    while(flag==1)
    {
        bzero(buf,128);
        printf("Input string:");
        // fgets(buf,sizeof(buf),stdin);
        scanf("%s",buf);
        fprintf(fp,"%s",buf);
        
        printf("\nContinue:?");
        scanf("%c",&c);
        if((getchar()== 'n') || (getchar()=='N'))
        {
            flag=0;
        }
    }
    fclose(fp);

    fseek(fp,0,SEEK_SET);
    char bf;
    while(1)
    {
        if(fscanf(fp,"%c",&bf)==1)
        {
            printf("%c",bf-32);
        }else{
            break;
        }
    }
    printf("\n");
    fclose(fp);
    return 0;
}
